﻿#include "widget.h"
#include "ui_widget.h"
#include<QMovie>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //栈控件使用
//设置默认定位
     ui->stackedWidget->setCurrentIndex(0);
    //first按钮
    connect(ui->first,&QPushButton::clicked,[=](){
       ui->stackedWidget->setCurrentIndex(0);
    });
    connect(ui->second,&QPushButton::clicked,[=](){
       ui->stackedWidget->setCurrentIndex(1);
    });
    connect(ui->third,&QPushButton::clicked,[=](){
       ui->stackedWidget->setCurrentIndex(2);
    });

    //下拉框
    ui->comboBox->addItem("one");
    ui->comboBox->addItem("two");
    ui->comboBox->addItem("three");

    connect(ui->pushButton_7,&QPushButton::clicked,[=](){
        ui->comboBox->setCurrentIndex(0);
    });
    connect(ui->pushButton_8,&QPushButton::clicked,[=](){
        ui->comboBox->setCurrentIndex(1);
    });
    connect(ui->pushButton_9,&QPushButton::clicked,[=](){
        ui->comboBox->setCurrentIndex(2);
    });

    //利用QLabel显示图片
    ui->label->setPixmap(QPixmap(":/Material _picture/ant1.jpeg"));

    //利用QLabel显示gif动态图片
    QMovie * move =new QMovie(":/Material _picture/xiaohaungren1.gif");
    ui->label_2->setMovie(move);
    //播放动图
    move->start();

}

Widget::~Widget()
{
    delete ui;
}

